<?php
/**
 * @author Gideon Amissah<kuulmek@yahoo.com>
 * @access public
 * @version 
 */

//$prpGropOpt = array('0'=>'All');
$prpGropOpt = array();
foreach($prpGroupData as $value){
    $prpGropOpt[$value['id']] = $value['group_name'];
}

/** $locOpt = array('0'=>'All'); */
$locOpt = array();
foreach($loc_data as $value){
    $locOpt[$value['id']] = $value['location_name'];
}

$yearOpt = array();
for($x=2010; $x< date('Y')+5; $x++){
    $yearOpt[$x] = $x;
}


$loggedUser =  $this->Session->read('userSessionData');
$loggedUser_id = $loggedUser['id'];
$modified_date = date('Y-m-d H:i:s');
$created_date = date('Y-m-d H:i:s');

?>
<script type="text/javascript">
	var gblPrpGroup = <?php echo json_encode($jsonArr) ;?>;
    var gblPrpGroupData = <?php echo json_encode($prpGroupData) ;?>;
    var gblLocData = <?php echo json_encode($locOpt) ;?>;
    var gblLocAreaCodeData = <?php echo json_encode($loc_data) ;?>;
    
</script>
<div class="property-pane" >
   <div class="pane-header">
       Bills Processing
   </div>
   
   <table id="billflex" style="display:none;"></table>
   
   <div style="display: none;">
      <div id="bill-form-window" class="form-window" style="width: 500px;">
    	<div class="bill-prompt" ></div>
        <?php echo $this->Form->create('Bill', array('default' => false, 'id' => 'bill-form', 'action' => 'add','inputDefaults' => array('label' => false,'div' => false)));?>	
          <div class="content">
               <div class="row">
                    <div class="label">Property Group</div>
				    <div class="data">
                        <?php echo $this->Form->input('property_group_id', array( 'div' => false, 'label' => false, 'id'=>'property_group_id', 'options' => $prpGropOpt));?> 
                    </div>
               </div>
               <div class="row location_id">
                    <div class="label">Location</div>
				    <div class="data">
                    <?php echo $this->Form->input('location_id', array( 'div' => false, 'label' => false, 'id'=>'location_id', 'options' => $locOpt));?> 
                    </div>
               </div> 
               <div class="row property_group_type_id">
                    <div class="label">Property Type</div>
				    <div class="data">
                        <?php echo $this->Form->input('property_group_type_id', array( 'div' => false, 'label' => false, 'id'=>'property_group_type_id', 'options' => array(0=>'')));?> 
                    </div>
                </div>
                <div class="row property_group_sub_type_id">
                    <div class="label">Property Sub Type</div>
				    <div class="data">
                        <?php echo $this->Form->input('property_group_sub_type_id', array( 'div' => false, 'label' => false, 'id'=>'property_group_sub_type_id', 'options' => array(0=>'')));?> 
                    </div>
                </div> 
                <div class="row year">
                    <div class="label">Bill Year</div>
				    <div class="data">
                    <?php echo $this->Form->input('year', array( 'div' => false, 'label' => false, 'id'=>'year' ,'class' => '', 'value'=>'', 'options' => $yearOpt)); ?>
                    </div>
                </div>
                <div class="row description">
                    <div class="label">Description</div>
				    <div class="data">
                    <?php echo $this->Form->input('description', array('type'=>'textarea', 'rows'=>4, 'cols'=>25 ,'div' => false, 'label' => false, 'id'=>'description' ,'class' => '', 'value'=>'')); ?>
                    </div>
                </div> 
                <div class="row">
                   <div class="label">

                   </div>
                   <div class="data"> 
                      <button type="button" class="save" id="bill-save-btn"><?php echo $this->Html->image('ico-49.gif', array('width' => '16', 'height' => '16', 'align' => 'left', 'border' => '0')); ?>&nbsp;Save</button>
                      <button type="button" class="cancel" id="bill-cancel-btn"><?php echo $this->Html->image('ico-43.png', array('width' => '16', 'height' => '16', 'align' => 'left', 'border' => '0')); ?>&nbsp;Cancel</button>
                   </div>
                </div>
            </div>
        <?php echo $this->Form->end();?>
      </div>
    </div>

    <div style="display: none;">
        <div id="applybill_colorbox" style="margin: 30px 20px 20px 20px;"></div>
    </div>
    
    <div style="display: none;">
        <div id="printbill_colorbox" style="margin: 30px 20px 20px 20px;"></div>
    </div>
    
    <form id="popUpform" method="post" action="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'printData')); ?>" target="PrintWindow">
        <input type="hidden" name="bill_id" id="bill_id" value="" />
        <input type="hidden" name="ids" id="ids"  value="" />
   </form>
    
<?php 
    echo $this->element('account/view'); 
    echo $this->element('account/add_bill_components'); 
?>
      
</div>


<input type="hidden" id="table-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'getBillList')); ?>" />
<input type="hidden" id="add-edit-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'add')); ?>" />
<input type="hidden" id="load-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'getBill')); ?>" />
<input type="hidden" id="delete-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'deleteBill')); ?>" />
<input type="hidden" id="delete-component-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'deleteBillComponent')); ?>" />
<input type="hidden" id="load-apply-bill-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'loadBillForApplication')); ?>" />
<input type="hidden" id="do-apply-bill-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'applyBill')); ?>" />
<input type="hidden" id="load-print-bill-url" value="<?php echo $this->Html->url(array('controller' => 'Account', 'action' => 'loadBillForPrint')); ?>" />


<?php
    echo $this->Html->script('custom-scripts/modify_bill.js',array('inline'=>false));
?>
